package net.apexcns.core.spring;

import net.apexcns.core.config.ConfigEnv;

import org.apache.log4j.Logger;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;

public abstract class CoreService {
	protected Logger logger = Logger.getLogger(getClass());
	protected ConfigEnv env = ConfigEnv.getConfig(ConfigEnv.class);
	protected CoreTxManager txManager;

	protected void setTxManager(CoreTxManager cmmTxManager) {
		txManager = cmmTxManager;
	}

	protected TransactionStatus getTransaction(CoreTxManager txManager) {
		DefaultTransactionDefinition def = new DefaultTransactionDefinition();
		def.setName("txManager");
		def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
		return txManager.getTransaction(def);	
	}

	protected void setRetCodeMsg(int retCode, String retMsg) {
		
	}
}
